Method and device for numerial control

ABSTRACT

A numerical control apparatus for controlling a machine having two moving shafts placed in parallel and separate servomotors  6  and  10  for driving one of the shafts as a master shaft and the other as a slave shaft in the same direction and performing return to origin of the above-mentioned master shaft and the slave shaft according to a dog technique. The numerical control apparatus comprises position determination means  16  for determining the positional relationship as to whether or not the master shaft is ahead of the slave shaft, and return-to-origin management means  14  for performing return to origin of the above-mentioned master shaft and the slave shaft with one dog based on the determination result of the position determination means, so that the return to origin of the master shaft and the slave shaft can be performed with one dog and moreover the return to origin can be performed reliably at parallel positions.

TECHNICAL FIELD

[0001] This invention relates to a numerical control method and itsapparatus for controlling a machine having two moving shafts placed inparallel and separate servomotors for driving one of the shafts as amaster shaft and the other as a slave shaft in the same direction and inparticular to control for performing return to origin of the mastershaft and the slave shaft according to a dog technique.

BACKGROUND ART

[0002] A numerical control apparatus performs return to origin toprecisely grasp the origin on a machine coordinate system in thenumerical control apparatus.

[0003] As a method of the return to origin, a technique for placing alimit switch for deceleration (dog) in the vicinity of the origin of amachine moving part is available. In the technique, when the machinemoving part steps on the dog, a deceleration command is given to aservomotor and a shift is made by the origin shift amount of thedifference between the origin and the grid position from the point intime at which the first grid position is reached leaving the dog,thereby stopping the shaft move. The grid is based on a Z phase pulseoutput every revolution from an encoder placed in the servomotor.

[0004]FIG. 6 is a drawing to describe the return-to-origin processingmethod of the dog technique. In the figure, numeral 131 denotes a dog,numerals 132, 133, and 134 are grids, numeral 135 denotes an originshift amount, and numeral 136 denotes a distance remote from the dog tothe first grid and adding the origin shift amount 135. As the originshift amount 135, a previous measurement value is preset in parametermemory of the numerical control apparatus as a parameter.

[0005] At time t1 at which the machine moving part steps on the dog 131,a deceleration command is given to the servomotor for once stopping andthen a move is started at sufficiently low speed (creep speed). When thedog 131 is left at time t2, a distance 136 of adding the distance fromthe position where the dog 131 is left to the first grid 133 and theorigin shift amount 135 is calculated and the shaft move is stopped atthe position. Accordingly, the shaft can be stopped precisely at theorigin.

[0006]FIGS. 7 and 8 are drawings to describe a return-to-originprocessing method in a related art in a numerical control apparatus forcontrolling a machine tool having a master shaft and a slave shaft (amachine having the two moving shafts placed in parallel and separateservomotors for driving one of the shafts as the master shaft and theother as the slave shaft in the same direction).

[0007] In FIG. 7, numeral 1 denotes a machine operation panel, numeral 2denotes a move command vector distribution means, numeral 3 denotesreturn-to-origin processing means of the master shaft, numeral 4 denotesacceleration/deceleration means of the master shaft, numeral 5 denotes adrive section of the master shaft, numeral 6 denotes a servomotor of themaster shaft, numeral 12 denotes a dog of the master shaft, numeral 15denotes an encoder of the master shaft, numeral 7 denotesreturn-to-origin processing means of the slave shaft, numeral 8 denotesacceleration/deceleration means of the slave shaft, numeral 9 denotes adrive section of the slave shaft, numeral 10 denotes a servomotor of theslave shaft, numeral 13 denotes a dog of the slave shaft, numeral 16denotes an encoder of the slave shaft, and numeral 17 denotes aparameter storage area for storing the origin shift amount, etc.

[0008] A return-to-origin command input through the machine operationpanel 1 is sent to the move command vector distribution means 2, whichthen outputs move commands to the master shaft and the slave shaft. Atthis time, the move commands given to the master shaft and the slaveshaft are set to have the same return-to-origin speed parameters are,for example. When a dog on signal is input from the dog 12, thereturn-to-origin processing means 3 of the master shaft cancels the movecommand of the master shaft and causes the master shaft to start to moveat creep speed after stop with deceleration. When the dog is turned off(a limit switch leaves the dog), the return-to-origin processing means 3acquires the distance to the current nearest grid from the encoder 15,moves the master shaft at creep speed at the distance of the distancefrom the dog off position to the nearest grid plus the origin shiftamount of the master shaft stored in the parameter storage area 17 asthe final move distance, and stops the master shaft when the mastershaft has been moved at the move distance.

[0009] On the other hand, as for the slave shaft, when a dog on signalis input from the dog 13 to the return-to-origin processing means 7 ofthe slave shaft independently of the master shaft, the return-to-originprocessing means 7 cancels the move command of the slave shaft andcauses the slave shaft to start to move at creep speed after stop withdeceleration. When the dog is turned off (limit switch leaves the dog),the return-to-origin processing means 7 acquires the distance to thenearest grid from the encoder 16, moves the slave shaft at creep speedat the distance of the distance from the dog off position to the nearestgrid plus the origin shift amount of the slave shaft stored in theparameter storage area 17 as the final move distance, and stops theslave shaft when the slave shaft has been moved at the move distance.

[0010] By the way, in the numerical control apparatus for controllingthe machine tool having the master shaft and the slave shaft, theorigins of the shafts need to be made parallel. If return to origin isexecuted in a state in which the dogs 12 and 13 of the master shaft andthe slave shaft are shifted in position, the move speed of the mastershaft and that of the slave shaft are placed out of synchronization andthus the dogs 12 and 13 of the master shaft and the slave shaft need tobe attached to parallel positions.

[0011]FIGS. 8a and 8 b are drawings to describe this point in detail.FIG. 8a is a drawing to represent the positional relationship betweenthe grids and the dogs of the master shaft and the slave shaft. FIG. 8bis a drawing to show the speed and time when return to origin is madewhen the grids and the dogs are at positions as in FIG. 8a.

[0012] In FIG. 8b, the vertical axis indicates the speed and thehorizontal axis indicates the time.

[0013] In FIG. 8a, numerals 50, 51, and 52 denote grids of the mastershaft, numerals 53, 54, and 55 denote grids of the slave shaft, numeral63 denotes the grid position shift amount between the master shaft andthe slave shaft, numeral 64 denotes the dog position shift amountbetween the master shaft and the slave shaft, numeral 56 denotes theorigin shift amount of the master shaft, numeral 57 denotes the originshift amount of the slave shaft (the distance between the grid 54 andorigin 59), numeral 58 denotes the origin of the master shaft, andnumeral 59 denotes the origin of the slave shaft.

[0014] To execute return to origin, as in FIG. 8b, the master shaftsteps on the dog at time TM1 and is decelerated. After completion of thedeceleration, the master shaft enters creep speed at time TM2. On theother hand, the slave shaft steps on the dog at time TS1 and isdecelerated. After completion of the deceleration, the slave shaftenters creep speed at time TS2. If the dogs of the master shaft and theslave shaft are shifted in position as shown in the figure, when returnto origin is executed, the speeds of the master shaft and the slaveshaft are not synchronized between the times TM1 and TS2.

[0015] Thus, in the related art, the dogs of the shafts need to beattached to parallel positions as much as possible, namely, the dogposition shift amount 64 shown in FIG. 8a needs to be set to almost 0and it is very difficult to adjust it.

[0016] A related art to the invention is disclosed in JP-A-8-22313. Inthe related art, the grid position shift amount between a master shaftand a slave shaft is calculated, the return-to-origin operation isperformed based on a preset grid shift amount for the master shaft, andthe return-to-origin operation of the master shaft and the slave shaftis performed based on the value resulting from adding grid shift amountand the position shift amount for the slave shaft, whereby thereturn-to-origin operation of the master shaft and the slave shaft isperformed to precise positions.

[0017] However, in the return-to-origin method in the related art, ifthe number of dogs is one, a defective condition of the possibility ofreturn to one-grid erroneous origin position may occur depending on thepositional relationship between the master shaft and the slave shaftwhen the power is turned on.

[0018]FIGS. 9 and 10 are drawings to show the above-mentioned defectivecondition.

[0019] In FIG. 9, numeral 90 denotes the position of the master shaftafter the dog is turned off, numeral 91 denotes the position of theslave shaft after the dog is turned off, numerals 101 and 102 denotegrids of the master shaft, numerals 103 and 104 denote grids of theslave shaft, and numerals 110 and 111 denote the origin shift amounts ofthe master shaft and the slave shaft, where are set to the same values.Numeral 112 denotes the grid position shift amount between the mastershaft and the slave shaft, and numerals 120 and 121 denote the originsof the master shaft and the slave shaft.

[0020] If the positional relationship between the master shaft and theslave shaft after the dog is turned off is the positional relationshipof 90 and 91 as in FIG. 9, the first grids of the shafts after the dogis turned off are 101 and 103. Therefore, the master shaft stops at theposition shifted by the origin shift amount 110 from the grid 101 andthe slave shaft stops at the position shifted by the grid position shiftamount 112 between the master shaft and the slave shaft plus the originshift amount 111 from the grid 103; the shafts return to the origins atparallel positions.

[0021] However, if the positional relationship between the master shaftand the slave shaft after the dog is turned off is the positionalrelationship of 92 and 93 as in FIG. 10, the first grids of the shaftsafter the dog is turned off become 101 and 104.

[0022] Thus, the master shaft stops at the position shifted by theorigin shift amount 110 from the grid 101 and the slave shaft stops atthe position shifted by the grid position shift amount 112 between themaster shaft and the slave shaft plus the origin shift amount 111 fromthe grid 104.

[0023] Therefore, one-grid shift occurs between the origin 120 of themaster shaft and the origin 121 of the slave shaft and the shafts cannotreturn to the origins at parallel positions; there is the possibility ofdestroying the machine.

DISCLOSURE OF THE INVENTION

[0024] The invention is intended for solving the problems as describedabove and it is an object of the invention to provide a numericalcontrol method and its apparatus for facilitating origin adjustment workof a master shaft and a slave shaft and enabling return to originreliably at parallel positions.

[0025] To accomplish the object, according to the invention, there isprovided a numerical control method of controlling a machine having twomoving shafts placed in parallel and separate servomotors for drivingone of the shafts as a master shaft and the other as a slave shaft inthe same direction and performing return to origin of theabove-mentioned master shaft and the slave shaft according to a dogtechnique, wherein in return to origin, the positional relationship isdetermined as to whether or not the above-mentioned slave shaft is aheadof the master shaft toward the origin direction, and the return toorigin of the above-mentioned master shaft and the slave shaft isperformed with one dog based on the determination result.

[0026] In the invention, virtual grids are set in the above-mentionedslave shaft at positions parallel with grids of the above-mentionedmaster shaft, if the determination result of the positional relationshipindicates that the above-mentioned slave shaft is behind theabove-mentioned master shaft toward the origin direction, return toorigin of the above-mentioned master shaft is performed based on thevalue resulting from adding the grid interval and an origin shift amountand return to origin of the slave shaft is performed based on the valueresulting from adding the distance from the position of the slave whenthe above-mentioned master shaft arrives at the first grid from steppingon the dog to the first virtual grid, the grid interval, and an originshift amount, and if the determination result of the positionalrelationship indicates that the above-mentioned slave shaft is ahead ofthe master shaft toward the origin direction, return to origin of theabove-mentioned master shaft is performed based on the value resultingfrom adding the grid interval and the origin shift amount and return toorigin of the above-mentioned slave shaft is performed based on thevalue resulting from adding the distance from the position of the slavewhen the master shaft arrives at the first grid from stepping on the dogto the first virtual grid and the origin shift amount.

[0027] In the invention, when the positional relationship is determinedas to whether or not the above-mentioned slave shaft is ahead of themaster shaft toward the origin direction, the determination is madebased on the value of a counter of the slave shaft.

[0028] In the invention, if the value of the counter which is clearedeach time a virtual grid of the slave shaft is passed through, andcounts the grid interval of the slave shaft is grid interval/2<countervalue≦grid interval when the master shaft is at the first grid positionafter the dog is turned off, it is determined that the above-mentionedslave shaft is behind the master shaft toward the origin direction, andif the value of the counter is 0≦counter value≦grid interval/2 when themaster shaft is at the first grid position after the dog is turned off,it is determined that the above-mentioned slave shaft is ahead of themaster shaft toward the origin direction.

[0029] In the invention, if the value of the counter which is clearedeach time an intermediate point between virtual grids of the slave shaftis passed through, and counts the grid interval of the slave shaft is0≦counter value≦grid interval/2 when the master shaft is at the firstgrid position after the dog is turned off, it is determined that theabove-mentioned slave shaft is behind the master shaft toward the origindirection, and if the value of the counter is grid interval/2<countervalue≦grid interval when the master shaft is at the first grid positionafter the dog is turned off, it is determined that the above-mentionedslave shaft is ahead of the master shaft toward the origin direction.

[0030] According to the invention, there is provided a numerical controlapparatus for controlling a machine having two moving shafts placed inparallel and separate servomotors for driving one of the shafts as amaster shaft and the other as a slave shaft in the same direction andperforming return to origin of the above-mentioned master shaft and theslave shaft according to a dog technique, the numerical controlapparatus comprising position determination means for determining thepositional relationship as to whether or not the above-mentioned slaveshaft is ahead of the master shaft toward the origin direction in returnto origin, and return-to-origin management means for performing thereturn to origin of the above-mentioned master shaft and the slave shaftwith one dog based on the determination result of the positiondetermination means.

[0031] In the invention, virtual grids are set in the above-mentionedslave shaft at positions parallel with grids of the above-mentionedmaster shaft, if the determination result of the above-mentionedposition determination means indicates that the above-mentioned slaveshaft is behind the master shaft toward the origin direction, theabove-mentioned return-to-origin management means performs return toorigin of the above-mentioned master shaft based on the value resultingfrom adding the grid interval and an origin shift amount and performsreturn to origin of the above-mentioned slave shaft based on the valueresulting from adding the distance from the position of the slave whenthe above-mentioned master shaft arrives at the first grid from steppingon the dog to the first virtual grid, the grid interval, and an originshift amount, and if the determination result of the above-mentionedposition determination means indicates that the above-mentioned slaveshaft is ahead of the master shaft toward the origin direction, theabove-mentioned return-to-origin management means performs return toorigin of the above-mentioned master shaft based on the value resultingfrom adding the grid interval and the origin shift amount and performsreturn to origin of the above-mentioned slave shaft based on the valueresulting from adding the distance from the position of the slave whenthe master shaft arrives at the first grid from stepping on the dog tothe first virtual grid and the origin shift amount.

[0032] In the invention, the above-mentioned position determinationmeans comprises a counter for counting the grid interval of the slaveshaft and when determining the positional relationship as to whether ornot the above-mentioned slave shaft is ahead of the master shaft towardthe origin direction, the above-mentioned position determination meansuses the above-mentioned counter to determine the positionalrelationship.

[0033] In the invention, the counter of the above-mentioned positiondetermination means is a counter cleared each time a virtual grid of theslave shaft is passed through, and if the value of the counter is gridinterval/2<counter value≦grid interval when the master shaft is at thefirst grid position after the dog is turned off, the above-mentionedposition determination means determines that the above-mentioned slaveshaft is behind the master shaft toward the origin direction, and if thevalue of the counter is 0≦counter value≦grid interval/2, theabove-mentioned position determination means determines that theabove-mentioned slave shaft is ahead of the master shaft toward theorigin direction.

[0034] In the invention, the counter of the above-mentioned positiondetermination means is a counter cleared each time an intermediate pointbetween virtual grids of the slave shaft is passed through, and if thevalue of the counter is 0≦counter value≦grid interval/2 when the mastershaft is at the first grid position after the dog is turned off, theabove-mentioned position determination means determines that theabove-mentioned slave shaft is behind the master shaft toward the origindirection, and if the value of the counter is grid interval/2<countervalue≦grid interval, the above-mentioned position determination meansdetermines that the above-mentioned slave shaft is ahead of the mastershaft toward the origin direction.

BRIEF DESCRIPTION OF DRAWINGS

[0035]FIG. 1 is a diagram to show the configuration of a numericalcontrol apparatus according to a first embodiment of the invention.

[0036]FIG. 2 is a drawing to describe virtual grids of a slave shaft ofthe numerical control apparatus according to the first embodiment of theinvention.

[0037]FIG. 3 is a drawing to show the move amounts to the origins of theshafts when the slave shaft is behind the master shaft in the numericalcontrol apparatus according to the first embodiment of the invention.

[0038]FIG. 4 is a drawing to show the move amounts to the origins of theshafts when the slave shaft is ahead of the master shaft in thenumerical control apparatus according to the first embodiment of theinvention.

[0039]FIG. 5 is a drawing to describe a method of determining whetherthe slave shaft is ahead of or behind the master shaft in the numericalcontrol apparatus according to the first embodiment of the invention.

[0040]FIG. 6 is a drawing to describe the return-to-origin operation ofa dog technique.

[0041]FIG. 7 is a diagram to show the configuration of a numericalcontrol apparatus in a related art for controlling a machine having amaster shaft and a slave shaft.

[0042]FIGS. 8a and 8 b are drawings to show the return-to-originoperation of the numerical control apparatus in the related art forcontrolling a machine having a master shaft and a slave shaft.

[0043]FIG. 9 is a drawing to describe the case where origin positionsare not erroneous if the number of dogs is one in a numerical controlapparatus in a different related art for controlling a machine having amaster shaft and a slave shaft.

[0044]FIG. 10 is a drawing to describe the case where origin positionsare erroneous if the number of dogs is one in the numerical controlapparatus in the different related art for controlling a machine havinga master shaft and a slave shaft.

BEST MODE FOR CARRYING OUT THE INVENTION

[0045] First Embodiment.

[0046] A first embodiment of a numerical control apparatus according tothe invention will be discussed with FIGS. 1 to 5.

[0047]FIG. 1 is a block diagram to show the configuration related toreturn to origin of the numerical control apparatus according to thefirst embodiment of the invention. In FIG. 1, numeral 11 denotes a dog,which is installed only for a master shaft. Numeral 14 denotesreturn-to-origin management means and numeral 19 denotes positiondetermination means. The detailed operation of the positiondetermination means will be discussed later together with the detailedoperation of the return-to-origin management means 14. Other componentsare similar to those in the related art.

[0048]FIG. 2 is a drawing to describe virtual grids of a slave shaft. Inthe first embodiment of the invention, the position determination means19 first virtually prepares grids of the slave shaft (which will behereinafter referred to as virtual grids) at positions parallel withgrids of the master shaft as in FIG. 2. The virtual grids are preparedby offsetting by offset amount from grids of the slave shaft.

[0049] In the usual return to origin, the position moved by the originshift amount from the first grid after the dog is turned off is set asthe origin, but the origin in the first embodiment of the invention isthe position moved by the origin shift amount from the second grid afterthe dog is turned off.

[0050] In FIG. 1, when a dog on signal is input from the dog 11, thereturn-to-origin management means 14 once decelerates the master shaftand causes the master shaft to move at creep speed. At this time, thereturn-to-origin management means 14 also causes the slave shaft to moveaccording to the same speed pattern in synchronization with the mastershaft. When a dog off signal is input from the dog 11, thereturn-to-origin management means 14 acquires the distance to thenearest grid from an encoder 15 of the master shaft and moves the mastershaft to the first grid. At this time, the return-to-origin managementmeans 14 acquires the move amount per unit time from return-to-originprocessing means 3 of the master shaft and sends the move amount toreturn-to-origin processing means 7 of the slave shaft, whereby theslave shaft moves in synchronization with the master shaft. Here, thereturn-to-origin management means 14 causes the position determinationmeans 19 to determine whether the master shaft is at a position ahead ofthe slave shaft (the slave shaft is at a lag position behind the mastershaft with respect to the return-to-origin direction) or the slave shaftis at a position ahead of the master shaft (the slave shaft is at aposition leading the master shaft with respect to the return-to-origindirection), and calculates the move amounts to the origins of the shaftsusing data from encoders 15 and 16. The move amounts to the origins ofthe shafts vary depending on the positional relationship between theshafts as described below:

[0051]FIG. 3 is a drawing to show the move amounts to the origins of theshafts when the slave shaft is behind the master shaft. In such apositional relationship, letting the distance to the origin of themaster shaft be c_(m) and the distance to the origin of the slave shaftbe c_(s),

[0052] c_(m)=b_(m)+sft_(m) b_(m): Grid interval of master shaft

[0053] sft_(m): Origin shift amount of master shaft

[0054] c_(s)=a_(s)+b_(s)+sft_(s)

[0055] a_(s): Distance from position of slave shaft when master shaftarrives at first grid to first virtual grid of slave shaft

[0056] b_(s): Grid interval of slave shaft

[0057] sft_(s): Origin shift amount of slave shaft (same value as originshift amount of master shaft)

[0058]FIG. 4 is a drawing to show the move amounts to the origins of theshafts when the slave shaft is ahead of the master shaft in the origindirection. In contrast, when the slave shaft is ahead of the mastershaft as in FIG. 4, letting the distance to the origin of the mastershaft be c_(m) and the distance to the origin of the slave shaft bec_(s),

[0059] c_(m)=b_(m)+sft_(m)

[0060] c_(s)=a_(s)+sft_(s)

[0061] Using the remaining distance thus calculated, the master shaftmoves at the remaining distance of the master shaft, whereby the mastershaft can arrive at the origin of the master shaft. The slave shaftmoves at the remaining distance of the slave shaft, whereby the slaveshaft can arrive at the origin of the slave shaft.

[0062] Next, a method for the position determination means 19 todetermine the positional relationship between the master shaft and theslave shaft, namely, whether the master shaft and the slave shaft havethe positional relationship in FIG. 3 or FIG. 4 will be discussed.

[0063] The position determination means 19 can determine which shaft isahead of the other assuming that the shift between the master shaft andthe slave shaft is less than a half of a grid.

[0064]FIG. 5 is a drawing to the determination method.

[0065] In FIG. 5, numeral 40 denotes the first grid after the dog isturned off in the master shaft, numerals 41 and 42 denote each anintermediate position between virtual grids in the slave shaft, andnumeral 45 denotes a counter which is set to 0 at each virtual gridpoint of the slave shaft and indicates the distance to the next virtualgrid; the maximum value becomes the grid interval (=Lmax). When theshafts move in the direction of an arrow 46, if the master shaft is atthe position of 40 and the slave shaft is in an area of 43, namely, whenthe counter 45 value is Lmax/2<counter value≦Lmax, it can be determinedthat the slave shaft is behind the master shaft. In contrast, if themaster shaft is at the position of 40 and the slave shaft is in an areaof 44, namely, when the counter 45 value is 0≦counter value≦Lmax/2, itcan be determined that the slave shaft is ahead of the master shaft.

[0066] To use a counter set to 0 at each intermediate point between thevirtual grids of the slave shaft, namely, a counter as indicated by thechain line in FIG. 5 as the counter of the slave shaft, when the shaftsmove in the direction of the arrow 46, if the master shaft is at theposition of 40 and the slave shaft is in the area of 43, namely, whenthe counter 45 value is 0≦counter value≦Lmax/2, it can be determinedthat the slave shaft is behind the master shaft. In contrast, if themaster shaft is at the position of 40 and the slave shaft is in the areaof 44, namely, when the counter 45 value is Lmax/2<counter value≦Lmax,it can be determined that the slave shaft is ahead of the master shaft.

[0067] As described above, according to the invention, in the numericalcontrol apparatus for executing return to origin of the master shaft andthe slave shaft according to the dog technique, it is made possible toexecute return to origin using only one dog and thus origin adjustmentwork is facilitated. Moreover, in return to origin, the positionalrelationship is determined as to whether or not the slave shaft is aheadof the master shaft toward the origin direction, so that it is madepossible to reliably execute return to origin at parallel positions.

INDUSTRIAL APPLICABILITY

[0068] The numerical control method and its apparatus according to theinvention are suited for performing return to origin of the master shaftand the slave shaft according to the dog technique when performingreturn to origin of a machine having two moving shafts placed inparallel and separate servomotors for driving one of the shafts as themaster shaft and the other as the slave shaft in the same direction.

1. A numerical control method of controlling a machine having two movingshafts placed in parallel and separate servomotors for driving one ofthe shafts as a master shaft and the other as a slave shaft in the samedirection and performing return to origin of the master shaft and theslave shaft according to a dog technique, characterized in that inreturn to origin, the positional relationship is determined as towhether or not the slave shaft is ahead of the master shaft toward theorigin direction, and the return to origin of the master shaft and theslave shaft is performed with one dog based on the determination result.2. The numerical control method as claimed in claim 1 wherein virtualgrids are set in the slave shaft at positions parallel with grids of themaster shaft, wherein if the determination result of the positionalrelationship indicates that the slave shaft is behind the master shafttoward the origin direction, return to origin of the master shaft isperformed based on the value resulting from adding the grid interval andan origin shift amount and return to origin of the slave shaft isperformed based on the value resulting from adding the distance from theposition of the slave when the master shaft arrives at the first gridfrom stepping on the dog to the first virtual grid, the grid interval,and an origin shift amount, and wherein if the determination result ofthe positional relationship indicates that the slave shaft is ahead ofthe master shaft toward the origin direction, return to origin of themaster shaft is performed based on the value resulting from adding thegrid interval and the origin shift amount and return to origin of theslave shaft is performed based on the value resulting from adding thedistance from the position of the slave when the master shaft arrives atthe first grid from stepping on the dog to the first virtual grid andthe origin shift amount.
 3. The numerical control method as claimed inclaim 1 or 2 wherein when the positional relationship is determined asto whether or not the slave shaft is ahead of the master shaft towardthe origin direction, the determination is made based on the value of acounter of the slave shaft.
 4. The numerical control method as claimedin claim 3 wherein if the value of the counter which is cleared eachtime a virtual grid of the slave shaft is passed through, and counts thegrid interval of the slave shaft is grid interval/2<counter value≦gridinterval when the master shaft is at the first grid position after thedog is turned off, it is determined that the slave shaft is behind themaster shaft toward the origin direction, and if the value of thecounter is 0≦counter value≦grid interval/2 when the master shaft is atthe first grid position after the dog is turned off, it is determinedthat the slave shaft is ahead of the master shaft toward the origindirection.
 5. The numerical control method as claimed in claim 3 whereinif the value of the counter which is cleared each time an intermediatepoint between virtual grids of the slave shaft is passed through, andcounts the grid interval of the slave shaft is 0≦counter value≦gridinterval/2 when the master shaft is at the first grid position after thedog is turned off, it is determined that the slave shaft is behind themaster shaft toward the origin direction, and if the value of thecounter is grid interval/2<counter value≦grid interval when the mastershaft is at the first grid position after the dog is turned off, it isdetermined that the slave shaft is ahead of the master shaft toward theorigin direction.
 6. A numerical control apparatus for controlling amachine having two moving shafts placed in parallel and separateservomotors for driving one of the shafts as a master shaft and theother as a slave shaft in the same direction and performing return toorigin of the master shaft and the slave shaft according to a dogtechnique, the numerical control apparatus comprising positiondetermination means for determining the positional relationship as towhether or not the slave shaft is ahead of the master shaft toward theorigin direction in return to origin, and return-to-origin managementmeans for performing the return to origin of the master shaft and theslave shaft with one dog based on the determination result of theposition determination means.
 7. The numerical control apparatus asclaimed in claim 6 wherein virtual grids are set in the slave shaft atpositions parallel with grids of the master shaft, wherein if thedetermination result of the position determination means indicates thatthe slave shaft is behind the master shaft toward the origin direction,the return-to-origin management means performs return to origin of themaster shaft based on the value resulting from adding the grid intervaland an origin shift amount and performs return to origin of the slaveshaft based on the value resulting from adding the distance from theposition of the slave when the master shaft arrives at the first gridfrom stepping on the dog to the first virtual grid, the grid interval,and an origin shift amount, and wherein if the determination result ofthe position determination means indicates that the slave shaft is aheadof the master shaft toward the origin direction, the return-to-originmanagement means performs return to origin of the master shaft based onthe value resulting from adding the grid interval and the origin shiftamount and performs return to origin of the slave shaft based on thevalue resulting from adding the distance from the position of the slavewhen the master shaft arrives at the first grid from stepping on the dogto the first virtual grid and the origin shift amount.
 8. The numericalcontrol apparatus as claimed in claim 6 or 7 wherein the positiondetermination means comprises a counter for counting the grid intervalof the slave shaft and wherein when determining the positionalrelationship as to whether or not the slave shaft is ahead of the mastershaft toward the origin direction, the position determination means usesthe counter to determine the positional relationship.
 9. The numericalcontrol apparatus as claimed in claim 8 wherein the counter of theposition determination means is a counter cleared each time a virtualgrid of the slave shaft is passed through, and wherein if the value ofthe counter is grid interval/2<counter value≦grid interval when themaster shaft is at the first grid position after the dog is turned off,the position determination means determines that the slave shaft isbehind the master shaft toward the origin direction, and if the value ofthe counter is 0≦counter value≦grid interval/2, the positiondetermination means determines that the slave shaft is ahead of themaster shaft toward the origin direction.
 10. The numerical controlapparatus as claimed in claim 8 wherein the counter of the positiondetermination means is a counter cleared each time an intermediate pointbetween virtual grids of the slave shaft is passed through, and whereinif the value of the counter is 0≦counter value≦grid interval/2 when themaster shaft is at the first grid position after the dog is turned off,the position determination means determines that the slave shaft isbehind the master shaft toward the origin direction, and if the value ofthe counter is grid interval/2<counter value≦grid interval, the positiondetermination means determines that the slave shaft is ahead of themaster shaft toward the origin direction.